


void tempControl(){
  if(fridgeTemp1 > fridgeSetTemp1 + tempHysteresis){
    turnCompressorON();
  }

  if(fridgeTemp1 <  fridgeSetTemp1 - tempHysteresis){
    turnCompressorOFF();
    
  }
}

void turnCompressorON(){
  if(millis()- millisCompressorOFF > minCompressorOFF){
    digitalWrite(TEMP_CONTROL_COOL,1);
    compressorON = true;
    millisCompressorON = millis();

  }
}

void turnCompressorOFF(){
  if(millis() - millisCompressorON > minCompressorON){
    digitalWrite(TEMP_CONTROL_COOL,0);
   compressorON = false; 
    millisCompressorOFF = millis();
 
  } 
}

